[SYCL] Forward decl free func kernel template args#21285
[SYCL] Forward decl free func kernel template args#21285KornevNikita wants to merge 6 commits intointel:syclfrom
Conversation
clang/test/CodeGenSYCL/free_function_default_template_arguments.cpp
Outdated
Show resolved
Hide resolved
tahonermann
left a comment
There was a problem hiding this comment.
Adding my approval with a comment regarding additional tests that I think would be useful.
| // CHECK-NEXT: template <typename scalar_t, typename F> void templated(scalar_t *); | ||
| // CHECK-NEXT: static constexpr auto __sycl_shim1() { | ||
| // CHECK-NEXT: return (void (*)(float *))templated<float, struct TestStruct<float>>; | ||
| // CHECK-NEXT: } |
There was a problem hiding this comment.
Thanks for moving the test declarations to a new test file. This suffices for the reported issue, so I'll accept the review.
If you aren't opposed, here are some other cases that I think would be useful to test.
template <auto V>
[[__sycl_detail__::add_ir_attributes_function("sycl-nd-range-kernel", 1)]]
void ffk1() {
}
template <typename> struct TestClassTemplate1 {
};
struct TestClass1;
template void ffk1<TestClassTemplate1<TestClass1>{}>();
template <typename T, template<typename> class CT>
[[__sycl_detail__::add_ir_attributes_function("sycl-nd-range-kernel", 1)]]
void ffk2(CT<T>) {}
template <typename> struct TestClassTemplate2 {
};
struct TestClass2;
template void ffk2(TestClassTemplate2<TestClass2>);
There was a problem hiding this comment.
Thanks. Sure, additional tests are always welcome. But this patch got a bunch of approvals and additional test cases may unveil some additional issues, so I will proceed with merging this one and creating a follow-up patch to not bother approvers with another round of review here.
|
@uditagarwal97 take a look please, just an E2E test. |
CMPLRLLVM-72459
This patch fixes compilation error that occur when a free function kernel has a template parameter.
Visit and forward declare template args of free functions kernels.